module ProfilesHelper
  
  def pick_portrait_image_file_url(user_id)
    image_dir = "#{ProfilesController::PICTURE_DIR}/#{user_id}"
    if File.exist?(image_dir)
      Dir.new(image_dir).each do |file|
        return "/pictures/#{user_id}/" + file if File.ftype(File.join(image_dir, file)) == "file"
      end
    else
      return "/pictures/default.jpg"
    end
  end
end
